﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="CustomerList.aspx.cs" Inherits="CustomerService.CustomerList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Customer List</title>
    <link rel="Stylesheet" href="style.css" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnHome" runat="server" Text="Home" OnClick="btnHome_Click" />
        <asp:ListView ID="ListView1" runat="server" OnPagePropertiesChanged="ListView_PagePropertiesChanged" >
            <LayoutTemplate>
                <table class="ItemList" cellpadding="3" cellspacing="0">
                    <tr style="font-weight: bold;">
                        <td></td>
                        <td>Key Type</td>
                        <td>CustomerID</td>
                        <td>Name</td>
                        <td>Address1</td>
                        <td>City</td>
                        <td>State</td>
                        <td>Zip</td>
                        <td>Most recent order</td>
                        <td>Owner</td>
                    </tr>
                    <tr id="itemPlaceholder" runat="server"></tr>
                </table>
                <asp:DataPager ID="DataPager1" runat="server" PageSize="20">
                    <Fields>
                        <asp:NumericPagerField  />
                    </Fields>
                </asp:DataPager>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td><asp:Button ID="btnSelect" runat="server" CommandName="SELECT" CommandArgument='<%# Eval("CustomerID") %>' 
                        Width="40" Text="Sel" OnCommand="btnSelect_Click" /></td>
                    <td><%# Eval("SearchKeyType") %></td>
                    <td style="text-align:right;"><%# Eval("CustomerID") %></td>
                    <td><%# Eval("Name") %></td>
                    <td><%# Eval("Address1") %></td>
                    <td><%# Eval("City") %> </td>
                    <td><%# Eval("State") %></td>
                    <td><%# Eval("PostalCode") %></td>
                    <td style="text-align:right;"><%# (Eval("OrderDate") == null) ? string.Empty : ((DateTime)Eval("OrderDate")).ToShortDateString() %></td>
                    <td><%# Eval("OwnerName") %></td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
    </div>
    </form>
</body>
</html>
